<html>
<title>Google Prediction API v1.1 JSON ClientLogin Sample</title>
<body>
<h2>Instructions for the Google Prediction API v1.1 JSON ClientLogin Sample</h2>

<h3>Browse Online</h3>

<ul>
  <li><a
    href="http://code.google.com/p/google-api-java-client/source/browse?repo=samples#hg/prediction-json-clientlogin-sample">Browse
  Source</a>, or main file <a
    href="http://code.google.com/p/google-api-java-client/source/browse/prediction-json-clientlogin-sample/src/com/google/api/client/sample/prediction/PredictionSample.java?repo=samples">PredictionSample.java</a></li>
</ul>

<h3>Checkout Instructions</h3>

<p><b>Prerequisites:</b> install <a href="http://java.com">Java 6</a>, <a
  href="http://mercurial.selenic.com/">Mercurial</a> and <a
  href="http://maven.apache.org/download.html">Maven</a>. You may need to set
your <code>JAVA_HOME</code>.</p>

<p><b>Important:</b> after checking out the project, and before compiling
and running it, you need to edit <a
  href="http://code.google.com/p/google-api-java-client/source/browse/prediction-json-clientlogin-sample/src/com/google/api/client/sample/prediction/ClientLoginCredentials.java?repo=samples">ClientLoginCredentials.java</a>
to enter a username and password that has access to the Google Prediction API.
Otherwise, you will get a <code>403 Forbidden</code> exception. You will also
need to upload the <a
  href="http://code.google.com/apis/predict/docs/language_id.txt">training
data</a> to Google Storage and edit the <code>OBJECT_PATH</code>.</p>

<pre><code>cd <i>[someDirectory]</i>
hg clone https://samples.google-api-java-client.googlecode.com/hg/ google-api-java-client-samples
cd google-api-java-client-samples/prediction-json-clientlogin-sample
<i>[editor]</i> src/com/google/api/client/sample/prediction/ClientLoginCredentials.java
mvn compile
mvn -q exec:java</code></pre>

<h3>Setup Project in Eclipse 3.5/3.6</h3>

<p><b>Prerequisites:</b> install <a href="http://www.eclipse.org/downloads/">Eclipse</a>,
the <a href="http://javaforge.com/project/HGE">Mercurial plugin</a>, and the <a
  href="http://m2eclipse.sonatype.org/installing-m2eclipse.html">Maven
plugin</a>.</p>

<ul>
  <li>Setup Eclipse Preferences
  <ul>
    <li>Window &gt; Preferences... (or on Mac, Eclipse &gt; Preferences...)</li>
    <li>Select Maven
    <ul>
      <li>check on "Download Artifact Sources"</li>
      <li>check on "Download Artifact JavaDoc"</li>
    </ul>
    </li>
  </ul>
  </li>
  <li>Import <code>prediction-json-clientlogin-sample</code> project
  <ul>
    <li>File &gt; Import...</li>
    <li>Select "General &gt; Existing Project into Workspace" and click
    "Next"</li>
    <li>Click "Browse" next to "Select root directory", find <code><i>[someDirectory]</i>/google-api-java-client-samples/prediction-json-clientlogin-sample</code>
    and click "Next"</li>
    <li>Click "Finish"</li>
  </ul>
  </li>
  <li>Run
  <ul>
    <li>Right-click on project <code>prediction-json-clientlogin-sample</code></li>
    <li>Run As &gt; Java Application</li>
    <li>If asked, type "PredictionSample" and click OK</li>
  </ul>
  </li>
</ul>

</body>
</html>
